package com.ruoyi.yljf.controller.AuthApiController;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.security.annotation.Anonymous;
import com.ruoyi.system.service.ISysDictDataService;
import com.ruoyi.yljf.domain.Article;
import com.ruoyi.yljf.domain.dto.CreateDTO.ArticleCreateDTO;
import com.ruoyi.yljf.domain.dto.PointLinkDTO;
import com.ruoyi.yljf.service.IArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * 咨询文章Controller
 * 
 * @author metaee
 * @date 2025-02-13
 */
@Anonymous
@RestController
@RequestMapping("/api/article")
public class AuthApiArticleController extends BaseController {
    @Autowired
    private IArticleService articleService;
    @Autowired
    private ISysDictDataService dictDataService;


    /**
     * 发布帖子---舍弃接口
     */
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ArticleCreateDTO dto) {
        Article article = new Article(dto);
        article.setCreateId(getUserId());
        return toAjax(articleService.save(article));
    }

//    /** 转发 */
//    @PutMapping(value = "forwarding/{articleId}")
//    public AjaxResult forwarding(@PathVariable("articleId") Long articleId) {
//        articleService.forwarding(articleId);
//        return success();
//    }

}
